﻿@using System.Data
@using ZoomLa.Common
@using ZoomLa.BLL
@using ZoomLa.Model
@using ZoomLa.Components
@model ZoomLa.SQLDAL.SQL.PageSetting
@{ 
    Model.cols = 6;
    Model.url = "Content_Data?action=recyle";
}
@functions{
    B_Content conBll = new B_Content();
    B_Model modelBll = new B_Model();
    public string GetUrl(string infoid)
    {
        int p = DataConverter.CLng(infoid);
        M_CommonData cinfo = conBll.GetCommonData(p);
        if (cinfo.IsCreate == 1)
            return SiteConfig.SiteInfo.SiteUrl + cinfo.HtmlLink;
        else
            return "/Page/PageContent?ItemID=" + p;
    }
    public string GetModel(string infoid)
    {
        int p = DataConverter.CLng(infoid);
        M_CommonData cinfo = conBll.GetCommonData(p);

        if (cinfo.ModelID == 0)
        {
            return "";
        }
        else
        {
            return "[" + modelBll.GetModelById(cinfo.ModelID).ItemName + "] ";
        }
    }
    public string GetCteate(string IsCreate)
    {
        int s = DataConverter.CLng(IsCreate);
        if (s != 1)
            return "<font color=red>×</font>";
        else
            return "<font color=green>√</font>";
    }
    public string GetStatus(DataRow dr)
    {
        return B_Content.GetStatusStr(DataConverter.CLng(dr["Status"]));
    }
}
<div id="EGV">
    <table class="table table-striped table-bordered table-hover">
        @if (Model.dt.Rows.Count < 1)
        {
            <tr><td colspan="6">当前没有信息!!</td></tr>
        }
        else
        {
            <tr><th>选择</th><th width="6%">ID</th><th width="50%">标题</th><th>状态</th><th>已生成</th><th>操作</th></tr>
            foreach (DataRow dr in Model.dt.Rows)
            {
                <tr>
                    <td><input type="checkbox" name="idchk" value="@dr[" GeneralID"]" /></td>
                    <td>@dr["ID"]</td>
                    <td><a href="@GetUrl(dr[" GeneralID"].ToString())" target="_blank">@GetModel(dr["GeneralID"].ToString()) @dr["Title"]</a></td>
                    <td>@GetStatus(dr)</td>
                    <td>@MvcHtmlString.Create(GetCteate(dr["IsCreate"].ToString()))</td>
                    <td>
                        <a href="javascript:;" id="rec_btn" onclick="mvcpage.del({ id: '@dr["GeneralID"]', url: 'content_recover', confirm: '确定要删除吗' });">还原</a>
                        <a href="javascript:;" id="del_btn" onclick="mvcpage.del({ id: '@dr["GeneralID"]', url: 'content_realdel', confirm: '你确定将该数据彻底删除吗' });">彻底删除</a>
                    </td>
                </tr>
            }
            @Html.Partial("_page", Model)
        }
    </table>
</div>